<template>
  <el-container class="layout-container-demo" style="height: 500px">
    <el-aside width="200px">
      <el-scrollbar>
        <el-menu :default-openeds="['1', '3']" router>
          <el-sub-menu>
            <template #title>
             用户管理
            </template>
            <el-sub-menu>
              <template #title>成绩管理</template>
              <el-menu-item index="/container/score">查询成绩</el-menu-item>
            </el-sub-menu>
            <el-sub-menu>
              <template #title>用户管理</template>
              <!--                点击这个 就需要进行路由跳转的-->
              <el-menu-item index="/container/userinfo" >查询用户</el-menu-item>
            </el-sub-menu>

          </el-sub-menu>
        </el-menu>
      </el-scrollbar>
    </el-aside>

    <el-container>
      <!--      头部 下拉菜单  给内容绑定一些事件即可-->
      <el-header style="text-align: right; font-size: 12px">
        <div class="toolbar">
          <el-dropdown>
            <el-icon style="margin-right: 8px; margin-top: 1px">
              <setting/>
            </el-icon>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item @click="logout()">退出</el-dropdown-item>
                <el-dropdown-item>修改密码</el-dropdown-item>
              </el-dropdown-menu>
            </template>
          </el-dropdown>
          <span>Tom</span>
        </div>
      </el-header>

      <!--主体部分就是  下拉+table表格-->
      <el-main>
        <el-scrollbar>
          <router-view></router-view>
        </el-scrollbar>
      </el-main>

    </el-container>


  </el-container>
</template>

<script lang="ts" setup>
import {ref} from 'vue'
import {Menu as IconMenu, Message, Setting} from '@element-plus/icons-vue'

const tableData = ref([])

import {useRouter} from 'vue-router'
const router=useRouter()

const logout = () => {
  router.push({
    path: '/login'
  })
}


</script>

<style scoped>
.layout-container-demo .el-header {
  position: relative;
  background-color: var(--el-color-primary-light-7);
  color: var(--el-text-color-primary);
}

.layout-container-demo .el-aside {
  color: var(--el-text-color-primary);
  background: var(--el-color-primary-light-8);
}

.layout-container-demo .el-menu {
  border-right: none;
}

.layout-container-demo .el-main {
  padding: 0;
}

.layout-container-demo .toolbar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  right: 20px;
}
</style>
